package edu.gatech.volt2.drdoommgt.domain;

import java.util.Calendar;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

/**
 * Creates labwork for the Patients
 * @author Khalen Morehead
 *
 */
@Entity
@Table(name="labwork")
public class Labwork 
{
	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	private long id;
	@ManyToOne(cascade = CascadeType.PERSIST)
	private Lab lab;
	private String results;
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar date;
	
	/**
	 * Default constructor
	 */
	public Labwork(){
	}
	
	/**
	 * @param lab the lab to set
	 */
	public void setLab(Lab lab) {
		this.lab = lab;
	}

	/**
	 * @return the lab
	 */
	public Lab getLab() {
		return lab;
	}

	/**
	 * @return the results
	 */
	public String getResults() {
		return results;
	}

	/**
	 * @param results the results to set
	 */
	public void setResults(String results) {
		this.results = results;
	}
	
	/**
	 * @param date the date to set
	 */
	public void setDate(Calendar date) {
		this.date = date;
	}

	/**
	 * @return the date
	 */
	public Calendar getDate() {
		return date;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(long id) {
		this.id = id;
	}

	/**
	 * @return the id
	 */
	public long getId() {
		return id;
	}
	
	public String toString(){
		return "["+lab.getDescription()+"] "+results+"";
	}
}
